/*
 * @copyright 2010 Gerald Jacobson
 * @license GNU General Public License
 * 
 * This file is part of Descent Assistant.
 *
 * Descent Assistant is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Descent Assistant is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Descent Assistant.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.amphiprion.descenttool.entity;

import java.io.Serializable;
import java.text.MessageFormat;

/**
 * @author Amphiprion
 * 
 */
public class Skill implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public String id;
	private String name;
	private String description;
	private int value;

	public Skill(String id, String name, String description) {
		this(id, name, description, 0);
	}

	public Skill(String id, String name, String description, int value) {
		this.id = id;
		this.name = name;
		this.description = description;
		this.value = value;
	}

	public int getValue() {
		return value;
	}

	public void setValue(int value) {
		this.value = value;
	}

	public String parseDescription() {
		return MessageFormat.format(description, value);
	}

	public String parseName() {
		if (value > 0) {
			return MessageFormat.format(name, value);
		} else {
			return name;
		}
	}
}
